Merge remote-tracking branch 'origin/master' into 'feature/type-hierarchy'
authorAndrea Corallo <acorallo@gnu.org>
Wed, 28 Feb 2024 19:47:57 +0000 (20:47 +0100)
committerAndrea Corallo <acorallo@gnu.org>
Wed, 28 Feb 2024 19:47:57 +0000 (20:47 +0100)
1  2 
doc/lispref/objects.texi
lisp/emacs-lisp/cl-preloaded.el
lisp/emacs-lisp/comp-cstr.el
src/data.c
test/src/comp-tests.el

Simple merge
index 0b30e10b344e93153f7ec03e6da9278a374e1ca5,840219c2260afae8e9b35f5860be3a2fd3cb0531..fb06b127676003f31aa470525f0452c3446e7771
          (apply #'error string (append sargs args))
        (signal 'cl-assertion-failed `(,form ,@sargs)))))
  
 -(defconst cl--typeof-types
 -  ;; Hand made from the source code of `type-of'.
 -  '((integer number integer-or-marker number-or-marker atom)
 -    (symbol-with-pos symbol atom) (symbol atom) (string array sequence atom)
 -    (cons list sequence)
 -    ;; Markers aren't `numberp', yet they are accepted wherever integers are
 -    ;; accepted, pretty much.
 -    (marker integer-or-marker number-or-marker atom)
 -    (overlay atom) (float number number-or-marker atom)
 -    (window-configuration atom) (process atom) (window atom)
 -    ;; FIXME: We'd want to put `function' here, but that's only true
 -    ;; for those `subr's which aren't special forms!
 -    (subr atom)
 -    ;; FIXME: We should probably reverse the order between
 -    ;; `compiled-function' and `byte-code-function' since arguably
 -    ;; `subr' is also "compiled functions" but not "byte code functions",
 -    ;; but it would require changing the value returned by `type-of' for
 -    ;; byte code objects, which risks breaking existing code, which doesn't
 -    ;; seem worth the trouble.
 -    (compiled-function byte-code-function function atom)
 -    (module-function function atom)
 -    (buffer atom) (char-table array sequence atom)
 -    (bool-vector array sequence atom)
 -    (frame atom) (hash-table atom) (terminal atom) (obarray atom)
 -    (thread atom) (mutex atom) (condvar atom)
 -    (font-spec atom) (font-entity atom) (font-object atom)
 -    (vector array sequence atom)
 -    (user-ptr atom)
 -    (tree-sitter-parser atom)
 -    (tree-sitter-node atom)
 -    (tree-sitter-compiled-query atom)
 -    (native-comp-unit atom)
 -    ;; Plus, really hand made:
 -    (null symbol list sequence atom))
 +
 +(defconst cl--type-hierarchy
 +  ;; Please run `sycdoc-update-type-hierarchy' in
 +  ;; etc/syncdoc-type-hierarchy.el each time this is updated to
 +  ;; reflect in the documentation.
 +  '((t sequence atom)
 +    (sequence list array)
 +    (atom
 +     class structure tree-sitter-compiled-query tree-sitter-node
 +     tree-sitter-parser user-ptr font-object font-entity font-spec
 +     condvar mutex thread terminal hash-table frame buffer function
 +     window process window-configuration overlay integer-or-marker
-      number-or-marker symbol array)
++     number-or-marker symbol array obarray)
 +    (number float integer)
 +    (number-or-marker marker number)
 +    (integer bignum fixnum)
 +    (symbol keyword boolean symbol-with-pos)
 +    (array vector bool-vector char-table string)
 +    (list null cons)
 +    (integer-or-marker integer marker)
 +    (compiled-function byte-code-function)
 +    (function subr module-function compiled-function)
 +    (boolean null)
 +    (subr subr-native-elisp subr-primitive)
 +    (symbol-with-pos keyword))
 +  "List of lists describing all the edges of the builtin type
 +hierarchy.
 +Each sublist is in the form (TYPE . DIRECT_SUBTYPES)"
 +  ;; Given type hierarchy is a DAG (but mostly a tree) I believe this
 +  ;; is the most compact way to express it.
 +  )
 +
 +(defconst cl--direct-supertypes-of-type
 +  (make-hash-table :test #'eq)
 +  "Hash table TYPE -> SUPERTYPES.")
 +
 +(cl-loop
 + for (parent . children) in cl--type-hierarchy
 + do (cl-loop
 +     for child in children
 +     do (cl-pushnew parent (gethash child cl--direct-supertypes-of-type))))
 +
 +(defconst cl--typeof-types nil
    "Alist of supertypes.
  Each element has the form (TYPE . SUPERTYPES) where TYPE is one of
  the symbols returned by `type-of', and SUPERTYPES is the list of its
Simple merge
diff --cc src/data.c
Simple merge
Simple merge